clear all; close all; clc;

R = 120;
C = 33e-12;
L = 100e-6;

omega0 = 1/sqrt(L*C); 
f0 = omega0 / 2 / pi;
fprintf('f0 = %f MHz\n', f0/1e6);


T = 1 / (100*f0);
t = 0:T:(10 * 1/f0);
lt = length(t);

Uc = nan(1, lt);
dUc = nan(1, lt);
i = nan(1, lt);
di = nan(1, lt);

U0 = 10;
U(1) = U0; 
i(1) = 0; 
 S = 15*U0*ones(1, lt); S(1) = U0; 
for k = 2:lt
    U(k)=U(k-1)+(i(k-1)*T)/C;
    i(k)=((S(k)-U(k))*T+i(k-1)*L)/(R*T+L);
    Uc(k)=i(k)/C;
end

figure(1);
plot(t*1e4, [ Uc;S]);
xlabel('t, ns') 
ylabel('U_c, S, Volt')
grid on



